package com.google.code.flickrlite;

/**
 * Defines the size of the image to download from Flickr.
 */
public enum PhotoSize {
	/**
	 * Small square image (75x75 px).
	 */
	Square("_s", 75),
	/**
	 * Thumbnail image (the longest side measures 100 px).
	 */
	Thumbnail("_t", 100),
	/**
	 * Small image (the longest side measures 240 px).
	 */
	Small("_m", 240),
	/**
	 * Medium image (the longest side measures 500 px).
	 */
	Medium("", 500),
	/**
	 * Large image (the longest side measures 1024 px).
	 */
	Large("_b", 1024),
	/**
	 * Original image size (requires a special original secret for each
	 * image)
	 */
	Original("_o", 0);

	private final String mSize;
	private final int mLongSide;

	private PhotoSize(String size, int longSide) {
		mSize = size;
		mLongSide = longSide;
	}

	/**
	 * Returns the size in pixels of the longest side of the image.
	 * 
	 * @return The dimension in pixels of the longest side.
	 */
	public int longSide() {
		return mLongSide;
	}

	/**
	 * Returns the name of the size, as defined by Flickr. For instance, the
	 * LARGE size is defined by the String "_b".
	 */
	public String size() {
		return mSize;
	}

	@Override
	public String toString() {
		return name() + ", longSide=" + mLongSide;
	}
}